varying float fogcoord;

uniform float decaluv;
uniform sampler2D diffusemap;
uniform float startfog;
uniform float endfog;

void main()
{
   vec2 uv = gl_TexCoord[0].xy;

   float stepu = floor(decaluv/10.0);
   stepu = fract(stepu/4.0)*4.0;

   float fog = (endfog - fogcoord) / (endfog-startfog);
   fog = clamp(fog,0.0,1.0);
   vec4 color = texture2D(diffusemap,gl_TexCoord[0].xy);

//    gl_FragColor = vec4(fog,fog,fog,1.0);
   gl_FragColor = mix(vec4(0.0,0.0,0.0,1.0),color,fog);

}